package javaio12.outputstreamdemo;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class FileDemo02
{

	public static void main(String[] args)
	{
		File f = new File("E:"+File.separator+"study2012"+File.separator+"4IOTest.txt");
		OutputStream out = null;
		try
		{
			out = new FileOutputStream(f,true);
		}
		catch(FileNotFoundException e)
		{
			e.printStackTrace();
		}
		String str = "\r\nHello World!!!";
		byte [] b = str.getBytes();
		try
		{
			for (int i = 0 ;i < b.length;i++)
			{
				out.write((int)b[i]);
			}
		}
		catch(IOException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try
		{
			out.close();
		}
		catch(IOException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
